#include <stdio.h>
#include <stdlib.h>
#include "makeargv.c"
#include "nodeStructure.c"
#include "parseInput.c"

//for 'status' variable:
#define INELIGIBLE 0
#define READY 1
#define RUNNING 2
#define FINISHED 3

int main(int argc, char* argv[]) {

	/*
	int x = 0;	
	if (argv[2] != NULL)
		x = atoi(argv[2]);
	*/
	
	int count = 0;
	int nbytes = 1024;
	char my_string[1024];
	char* fileName = NULL;
	FILE *fd;
	
	/* Initializing maximum number of nodes */
	node_t nodeList[50];
	
	if (argv[1] != NULL)
		fileName = argv[1];
	//printf(fileName);
	
	char *delimiter = ":";
	
	fd = fopen(fileName,"r");
		if (fd != NULL) {
		
			//TODO: finish parseInput function
			parseInput(fd, my_string, delimiter);
			
			/*
			while (fgets(my_string, sizeof(my_string), fd) != NULL) {
				makeargv(my_string, delimiter, &myargv);
				//printf("%d", numTokens); //Should always be 4
				
			}
			*/
			fclose(fd);
		}
		else
			perror(fileName);
	
	/*
	if ((fd = fopen(argv[1],"r")) == NULL) {
		perror("Couldn't open file for reading");
		return -1;
	}
	*/
		
		
	/*
	while((fgets(&my_string,&nbytes, fd)) != NULL) {
		if(++count == x) {
			printf("%s",my_string);
		}
	*/
	
	return 0;
}
